Skip to content

#25 [Feat] 관점 생성, 수정 시 GPT 검수#31

Open
HYH0804 wants to merge 2 commits intodevfrom
feat/#25
Open

#25 [Feat] 관점 생성, 수정 시 GPT 검수#31
HYH0804 wants to merge 2 commits intodevfrom
feat/#25

Conversation

@HYH0804
Copy link
Contributor

@HYH0804 HYH0804 commented Mar 16, 2026

● ## #️⃣ 연관된 이슈

📝 작업 내용

✨ Feat

내용 파일
GPT 비동기 검수 서비스 구현 (PENDING → PUBLISHED / REJECTED / MODERATION_FAILED) GptModerationService.java
관점 생성/수정 시 GPT 검수 비동기 호출 연동 PerspectiveService.java
검수 재시도 API 구현 (POST /perspectives/{id}/moderation/retry) PerspectiveController.java, PerspectiveService.java
MODERATION_FAILED 상태 추가 PerspectiveStatus.java
PERSPECTIVE_MODERATION_NOT_FAILED 에러 코드 추가 ErrorCode.java
@EnableAsync 설정 추가 AsyncConfig.java
OpenAI API 설정 추가 (api-key, url, model) application.yml
관점 상태 직접 변경 메서드 추가 Perspective.java

♻️ Refactor

내용 파일

🐛 Fix

내용 파일

📌 공유 사항

  1. OpenAI API Key는 .envOPENAI_API_KEY로 설정이 필요합니다. 노션 환경 설정 파일 확인 부탁드립니다!
  2. @Async + @Transactional 동시 사용 시 트랜잭션이 호출 쓰레드에서 커밋되어 비동기 쓰레드에서 DB 반영이 안 되는
    문제로, GptModerationService에서 @Transactional 제거 후 save() 명시 호출 방식으로 처리했습니다.

✅ 체크리스트

  • Reviewer에 팀원들을 선택했나요?
  • Assignees에 본인을 선택했나요?
  • 컨벤션에 맞는 Type을 선택했나요?
  • Development에 이슈를 연동했나요?
  • Merge 하려는 브랜치가 올바르게 설정되어 있나요?
  • 컨벤션을 지키고 있나요?
  • 로컬에서 실행했을 때 에러가 발생하지 않나요?
  • 팀원들에게 PR 링크 공유를 했나요?

📸 스크린샷

수정 시 아래와 같습니다.

올바른 관점 수정
image
image
image

욕설 관점
image
image
image

생성 시 아래와 같습니다.

올바른 관점 생성
image
image
image

욕설 관점 생성
image
image
image

💬 리뷰 요구사항

  1. GPT API 호출 실패 시 최대 2회 재시도 후 MODERATION_FAILED로 전환되는 구조인데, 재시도 횟수나 대기 시간(현재 2초)
    조정이 필요한지 의견 부탁드립니다.
  2. Prompt 의 경우 임시로
    "당신은 콘텐츠 검수 AI입니다. 입력된 텍스트에 욕설, 혐오 발언, 폭력적 표현, 성적 표현, 특정인을 향한 공격적 내용이 포함되어 있는지 판단하세요. " + "문제가 있으면 'REJECT', 없으면 'APPROVE' 딱 한 단어만 응답하세요.";

로 진행 중입니다.

@HYH0804 HYH0804 self-assigned this Mar 16, 2026
Copy link
Contributor

@si-zero si-zero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI 검수 프롬프트는 한국어 특성상 중의적 표현처럼 애매하게 작성할 수가 있어서 나중에 고도화해보는 것도 좋아보입니다.

재시도 횟수와 대기 시간은 적절하게 엄청 잘해주신 것 같습니다. 고생하셨습니다!

} catch (Exception e) {
lastException = e;
if (attempt < MAX_ATTEMPTS) {
try { Thread.sleep(2000); } catch (InterruptedException ie) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요친구도 상수화 해서 관리하면 좋을 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants